# $Id$
# Maintainer: Jan de Groot <jgc@archlinux.org>
# Contributor: Sarah Hay <sarah@archlinux.org>

pkgname=glib-perl
pkgver=1.324
pkgrel=4
pkgdesc="Perl wrappers for glib 2.x, including GObject"
arch=(i686 x86_64)
license=('LGPL')
url="http://gtk2-perl.sourceforge.net/"
options=('!emptydirs')
depends=('glib2' 'perl')
makedepends=('perl-extutils-depends' 'perl-extutils-pkgconfig')
source=(https://downloads.sourceforge.net/sourceforge/gtk2-perl/Glib-${pkgver}.tar.gz)
sha256sums=('701a214b5b9f17c1b783d807efa1944bfd612939a467b03bc02bd4cf90ad9b4e')

build() {
  cd Glib-$pkgver
  PERL_USE_UNSAFE_INC=1 \
  perl Makefile.PL INSTALLDIRS=vendor
  PERL_USE_UNSAFE_INC=1 \
  make
}

check() {
  cd Glib-$pkgver
  make test
}

package() {
  cd Glib-$pkgver
  make DESTDIR="${pkgdir}" install

# template start; name=perl-binary-module-dependency; version=1;
if [[ $(find "$pkgdir/usr/lib/perl5/" -name "*.so") ]]; then
	_perlver_min=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]);')
	_perlver_max=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]+1);')
	depends+=("perl>=$_perlver_min" "perl<$_perlver_max")
fi
# template end;
}
